package com.qcs.ando.phone;

import android.content.Context;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.widget.TextView;

import com.qcs.ando.BaseActivity;
import com.qcs.ando.R;

public class InfoActivity extends BaseActivity {
    private TextView phoneInfoTxt;
    private TextView osInfoTxt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.phone_info_lay);

        phoneInfoTxt = (TextView) findViewById(R.id.phoneInfoTxt);
        osInfoTxt = (TextView) findViewById(R.id.osInfoTxt);

        phoneInfoTxt.setText(getPhoneInfo());
        osInfoTxt.setText(getOSInfo());
    }

    private String getPhoneInfo() {
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        String IMSI = tm.getSubscriberId();
        if (null == IMSI) {
            IMSI = tm.getDeviceId();
        }

        if (null == IMSI) {
            return "";
        }

        return IMSI;
    }

    /**  */
    private String getOSInfo() {
        String osInfo = "Product: " + android.os.Build.PRODUCT;
        osInfo += ", CPU_ABI: " + android.os.Build.CPU_ABI;
        osInfo += ", TAGS: " + android.os.Build.TAGS;
        osInfo += ", VERSION_CODES.BASE: "
                + android.os.Build.VERSION_CODES.BASE;
        osInfo += android.os.Build.MODEL;
        osInfo += ", SDK: " + android.os.Build.VERSION.SDK;
        osInfo += ", VERSION.RELEASE: " + android.os.Build.VERSION.RELEASE;
        osInfo += ", DEVICE: " + android.os.Build.DEVICE;
        osInfo += ", DISPLAY: " + android.os.Build.DISPLAY;
        osInfo += ", BRAND: " + android.os.Build.BRAND;
        osInfo += ", BOARD: " + android.os.Build.BOARD;
        osInfo += ", FINGERPRINT: " + android.os.Build.FINGERPRINT;
        osInfo += ", ID: " + android.os.Build.ID;
        osInfo += ", MANUFACTURER: " + android.os.Build.MANUFACTURER;
        osInfo += ", USER: " + android.os.Build.USER;

        return osInfo;
    }
}
